package iteratortest;

import java.util.ArrayList;
import java.util.Iterator;

public class Menu extends MenuCompoment {
	ArrayList menuComponent=new ArrayList();
	String name;
	String description;
	public Menu(String name, String description) {
		super();
		this.description=description;
		this.name = name;
	}
	public void add(MenuCompoment menuComponent){
		menuComponent.add(menuComponent);
	}
	public void remove(MenuCompoment menuComponent){
		menuComponent.remove(menuComponent);
	}
	public MenuCompoment getChild(int i){
		return (MenuCompoment) menuComponent.get(i);
	}
	public String getName(){
		return name;
		
	}
	public String getDescription(){
		return description;
	}
	public void print(){
		System.out.println("\n"+getName());
		System.out.println(","+getDescription());
		System.out.println("-------------------");
		Iterator iterator=menuComponent.iterator();
		while(iterator.hasNext()){
			MenuCompoment menuComponent=(MenuCompoment) iterator.next();
			menuComponent.print();
		}
	}
	

}
